//
//  ST_PinterestHomeController.swift
//  btvideo
//
//  Created by mac on 2019/12/23.
//  Copyright © 2019 JarvanZhang. All rights reserved.
//

import UIKit
import SnapKit
import SwifterSwift
import SwiftyUserDefaults
//import ST_CHTCollectionViewWaterfallLayout
import NIMSDK
import EasyTipView
import RealmSwift
import SwiftyAttributes
import KTVHTTPCache
import MJRefresh
import SwiftyJSON


/**
 只跳转 ST_PairsCenterViewController的时候使用
 */
class PairsCenterInteractiveNavigationController: ST_PortraitBaseController, UINavigationControllerDelegate {
    
    
    
    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }
    
    override init(rootViewController: UIViewController) {
        super.init(rootViewController: rootViewController)
        
        self.navigationBar.isHidden = true
        self.interactivePopGestureRecognizer?.delegate = nil
        self.interactivePopGestureRecognizer?.isEnabled = false
        
        self.delegate = self
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
        
        
        if viewController.isKind(of: ST_PairsCenterViewController.self) || viewController.isKind(of: ST_PeculiarityGroupViewController.self){
            self.interactivePopGestureRecognizer?.isEnabled = false
        }else{
            self.interactivePopGestureRecognizer?.isEnabled = true
        }
        
        print("当前 展示的 Controller：",viewController)
        
    }
}



extension UIButton{
    
    static func createFilterBtn()->UIButton{
        
        let control = UIButton.init(type: UIButton.ButtonType.custom)
        control.backgroundColor = UIColor.init(white: 1, alpha: 0.95)
        control.setTitleForAllStates("精准搜索")
        control.setTitleColorForAllStates(UIColor.init(hex: 0x333333)!)
        control.setImageForAllStates(ST_ImageUtils.imageName("Pinterest首页筛选")!)
        control.layer.cornerRadius = 25
        control.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.2).cgColor
        control.layer.shadowOffset = CGSize(width: 0, height: 0)
        control.layer.shadowOpacity = 1
        control.layer.shadowRadius = 15
        control.titleEdgeInsets = UIEdgeInsets.init(top: 0, left: 5, bottom: 0, right: 0)
        control.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.medium)
        
        return control
        
    }
    
}
